package com.currentcms.shared.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/* site is owned by user, has participants who can add, edit, change wkflw */
public class Site
{

	List<User> users;
	List<Role> roles;
	Schema schema;
	List<WorkflowRule> workflow_rules;
	Map<String, SiteMap> site_maps;

	public Site()
	{
		users = new ArrayList<User>();
		roles = new ArrayList<Role>();
		workflow_rules = new ArrayList<WorkflowRule>();
		site_maps = new HashMap<String, SiteMap>();
	}

	public List<User> getUsers()
	{
		return users;
	}

	public User addUser(String email, String pw, Role role)
	{
		User u = new User();
		u.email = email;
		u.pw = pw;
		u.role = role;
		users.add(u);
		return u;
	}

	public List<Role> getRoles()
	{
		return roles;
	}

	public Role addRole(String name)
	{
		return addRole(name, null);
	}

	public Role addRole(String name, String description)
	{
		Role r = new Role();
		r.name = name;
		r.description = description;
		roles.add(r);
		return r;
	}

	public Schema getSchema()
	{
		return schema;
	}

	public void setSchema(Schema schema)
	{
		this.schema = schema;
	}

	public List<WorkflowRule> getWorkflowRules()
	{
		return workflow_rules;
	}

	public void addWorkflowRules(WorkflowRule workflow_rule)
	{
		this.workflow_rules.add(workflow_rule);
	}

	public SiteMap getSiteMap(String name)
	{
		return site_maps.get(name);
	}

	public void addSiteMap(String name, SiteMap site)
	{
		site_maps.put(name, site);
	}

}
